package vnreal.ZNEW.Algorithms;

import vnreal.ZNEW.GraphTest.CostHelper;
import vnreal.ZNEW.GraphTest.Link;
import vnreal.ZNEW.GraphTest.Node;
import vnreal.ZNEW.GraphTest.Path;

public class EA3 extends EnergyAlgorithm {
	private final static EA3 ea3;

	static {
		ea3 = new EA3();
	}

	private EA3() {
		super();
	}

	public static EA3 getAlgorithm() {

		return ea3;
	}

	@Override
	protected double calculateCost(Node node, Link lnk, int i, Path p) {
		double currentCost = 0;
		currentCost += (Double.parseDouble(lnk.bandwith) / 1000) * CostHelper.turnOnPort;
		if (!node.isOn) {
			currentCost += Double.parseDouble(node.energy) * CostHelper.CostOfNodeOn;
		}
		return currentCost;
	}
}